package com.wx.chapter11.homework;

/**
 * @Author : 佩萁
 * Description :
 * @Create : 2023/6/14 - 10:13
 */
public class Test04 {

    public static void main(String[] args) {
//        CellPhone cellPhone = new CellPhone();
//        cellPhone.testWork(new Calc() {
//            @Override
//            public double work(double n1, double n2) {//实现接口方法
//                return n1 + n2;
//            }
//        }, 1, 2);


        CellPhone cellPhone = new CellPhone();
        //两数相加
        cellPhone.testWork(new Calc() {
            @Override
            public double work(double n1, double n2) {
                return n1 + n2;
            }
        }, 1, 3);

        //两数相乘
        cellPhone.testWork(new Calc() {
            @Override
            public double work(double n1, double n2) {
                return n1 * n2;
            }
        }, 2, 4);
    }
}
